package mango.web.client.admin;

import mango.web.client.C;

import com.google.gwt.user.client.rpc.IsSerializable;

public class ContactVo implements IsSerializable {
	public static String _contactId = "contactId";
	public static String _memberId = "member";
	public static String _firstname = "firstname";
	public static String _surname = "surname";
	public static String _BHPhone = "BHPhone";
	public static String _AHPhone = "AHPhone";
	public static String _fax = "fax";
	public static String _identifier = "identifier";
	public static String _mobile = "mobile";
	public static String _email = "email";
	public static String _service = "service";
	public static String _businessStreet = "businessStreet";
	public static String _businessCity = "businessCity";
	public static String _businessState = "businessState";
	public static String _businessCountry = "businessCountry";
	public static String _businessPostCode = "businessPostCode";
	public static String _postalStreet = "postalStreet";
	public static String _postalCity = "postalCity";
	public static String _postalState = "postalState";
	public static String _postalCountry = "postalCountry";
	public static String _postalPostCode = "postalPostCode";

	public Integer contactId;
	public Integer memberId;
	public String firstname = "";
	public String surname = "";
	public String BHPhone = "";
	public String AHPhone = "";
	public String fax = "";
	public String identifier = "";
	public String mobile = "";
	public String email = "";
	public String service = "";
	public String businessStreet = "";
	public String businessCity = "";
	public String businessState = "";
	public String businessCountry = "";
	public String businessPostCode = "";
	public String postalStreet = "";
	public String postalCity = "";
	public String postalState = "";
	public String postalCountry = "";
	public String postalPostCode = "";

	public Integer mailMemberId;
	public Integer mailContactId;
	public Integer emailFaxContactId;

	public String status = "";

	//////////
	public String memberBusinessName = "";

	public String getStatus() {
		return C.getStatus(this.status);
	}

	public String getCaption() {
		String str = this.firstname + " " + this.surname;
		if ("".equals(str.trim())) str = "[empty]";
		if ("suspended".equals(this.status)) {
			str += " [" + this.status + "]";
		}
		return str;
	}

	public String getService() {
		String[] arr = ("" + this.service).split("&&");
		String SMS = null;
		String EMAIL = null;
		String FAX = null;
		String mangoMatters = null;
		for (int j = 0; j < arr.length; j++) {
			if (arr[j].toUpperCase().indexOf("SMS") != -1) {
				SMS = "SMS";
			} else if (arr[j].toUpperCase().indexOf("EMAIL") != -1) {
				EMAIL = "EMAIL";
			} else if (arr[j].toUpperCase().indexOf("FAX") != -1) {
				EMAIL = "FAX";
			} else if (arr[j].toUpperCase().indexOf("Mango Matters".toUpperCase()) != -1) {
				mangoMatters = "Mango Matters";
			}

		}
		String service = "";
		if (SMS != null) service += SMS + ", ";
		if (EMAIL != null) service += EMAIL + ", ";
		if (FAX != null) service += FAX + ", ";
		if (mangoMatters != null) service += mangoMatters + ", ";
		if (!"".equals(service)) {
			service = service.substring(0, service.length() - 2);
		}
		return service;
	}

	public boolean isServiceAmia() {
		if (this.service.toUpperCase().indexOf("AMIA".toUpperCase()) >= 0) return true;
		return false;
	}

	public boolean isServiceWorkshops() {
		if (this.service.toUpperCase().indexOf("Workshops".toUpperCase()) >= 0) return true;
		return false;
	}

	public boolean isServiceEmail() {
		if (this.service.toUpperCase().indexOf("EMAIL".toUpperCase()) >= 0) return true;
		return false;
	}

	public boolean isServiceFax() {
		if (this.service.toUpperCase().indexOf("FAX".toUpperCase()) >= 0) return true;
		return false;
	}

	public boolean isServiceSms() {
		if (this.service.toUpperCase().indexOf("SMS".toUpperCase()) >= 0) return true;
		return false;
	}
}
